﻿@using OA.Model.Config
@{
    Layout = null;
    OA.Model.BaseConfig baseConfig = ViewBag.BaseConfig;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta content="IE=edge" http-equiv="X-UA-Compatible">
    <title>@baseConfig.SiteName</title>
    <link rel="icon" type="image/png" href="/i/favicon.ico" />
    <link rel="stylesheet" href="@baseConfig.OssUrl/css/login.css" />
    <link rel="stylesheet" href="@baseConfig.OssUrl/css/swiper.min.css" />
</head>
<body class="page-login-v3">
    <div class="container">
        <div id="wrapper" class="login-body">
            <div class="swep-left">
                <div>
                    <div class="swiper-container">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide"><img src="/img/login_bg.jpg"></div>
                            <div class="swiper-slide"><img src="/img/login_bg1.jpg"></div>
                            <div class="swiper-slide"><img src="/img/login_bg2.jpg"></div>
                        </div>
                        <div class="swiper-pagination"></div>
                    </div>
                </div>
                <div class="denl">
                    <p class="denl-p">H5 文化</p>
                    <ul>
                        <li>诚信</li>
                        <li>健康</li>
                        <li>富足</li>
                        <li>友爱</li>
                        <li>快乐</li>
                    </ul>
                    <ul>
                        <li>Honest</li>
                        <li>Health</li>
                        <li>Harvest</li>
                        <li>Help</li>
                        <li>Happy</li>
                    </ul>
                </div>
            </div>
            <div class="login-content" id="login">
                <div class="brand">
                    <img alt="logo" class="brand-img" src="/img/logo.png">
                    <h2 class="brand-text">慈云Jwgl</h2>
                </div>
                <form id="login-form" class="login-form layui-form" method="post">
                    <div class="form-group">
                        <input name="userName" placeholder="请输入用户名" lay-reqtext="用户名不能为空" type="text" autocomplete="off" lay-verify="required">
                    </div>
                    <div class="form-group">
                        <input name="Password" placeholder="请输入密码" lay-reqtext="密码不能为空" type="password" autocomplete="off" lay-verify="required">
                    </div>
                    <div class="form-group imgCode_div">
                        <input name="ValidateCode" class="validatecode" placeholder="请输入图形验证码" lay-reqtext="图形验证码不能为空" type="text" autocomplete="off" lay-verify="required">
                        <img src="" class="imgCode">
                    </div>
                    <input type="hidden" name="login[type]" id="type" value="login" />
                    <div class="form-group" style="margin-bottom:-21px;">
                        <button id="login-submit" type="button" class="layui-btn">登录</button>

                    </div>
                </form>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="@baseConfig.OssUrl/js/jquery-3.4.1.min.js"></script>
    <script type="text/javascript" src="@baseConfig.OssUrl/front/layui/layui.js"></script>
    <script type="text/javascript" src="@baseConfig.OssUrl/js/swiper.min.js"></script>

    <script type="text/javascript"> 
        var layer;
        layui.use(['layer'],function () {
            var layer = layui.layer;
        });
        $("#login-submit").click(function () {
            $("#login-submit").prop('disabled', true);
            $.post("/Home/Index?rnd" + Math.random(), $("#login-form").serialize(), function (result) {
                
                if (result.code == 1) {
                    console.log(result);
                    layer.msg("登陆成功", { time: 1500, anim: 1 }, function () {
                        window.location = "/Member/Home/Desk";
                    });
                }
                else {
                    $("#login-submit").prop('disabled', false);
                    $("img.imgCode").click();
                    layer.msg(result.msg, { time: 1500, anim: 6 });
                }
                return false;
            }, 'json');
            return false;
        });
        var swiper = new Swiper('.swiper-container', {
            loop: true,
            autoplay: {
                delay: 3000,
            },
            pagination: {
                el: '.swiper-pagination',
            },
        });
        function GetValidateImage() {
            $.getJSON("/Home/ValidateImage?type=0", function (result) {
                if (result.State == 200) {
                    $(".imgCode").prop("src", "data:image/png;base64," + result.Data);
                }
            })
        }
        $("img.imgCode").click(function () {
            GetValidateImage();
        });
        GetValidateImage();
    </script>
</body>
</html>
